from pydantic import BaseModel, Field, validator
from typing import List, Optional


class NewUser(BaseModel):
    username: str
    password: str
    screen_name: str
    role: str = Field(title='用户的角色', regex=r'(common)|(admin)', description='`common` or `admin` ')
    description: Optional[str]


class UserUpdateInfo(BaseModel):
    """
    用于更新用户信息
    """
    username: str = Field(title='用于指示某个用户的字段')
    password: Optional[str]
    screen_name: Optional[str]
    role: Optional[str] = Field(title='用户的角色', regex=r'(common)|(admin)', description='`common` or `admin` ')
    description: Optional[str]
